import 'package:flutter_pink_app/net/base/error.dart';
import 'package:flutter_pink_app/net/base/response.dart';
import 'package:flutter_pink_app/net/request/favourite_request.dart';
import '../net/index.dart';
import '../net/adater/dio_adapter.dart';

// const successStatus = '取消收藏成功'; // 请求成功标识

// 视频详情列表页请求列表方法
Future<BaseResponse<bool>> cancelFavourite(String uid) async {
  final network = NetworkCall.getInstance(adapter: DioAdapter());
  BaseResponse<bool> response;
  final req = FavouriteRequest(uid, isDelete: true);
  try {
    response = await network.send(req);
  } on BaseNetworkError catch (e) {
    e.expectedErrorLog();
    print('收藏视频接口请求时发生错误。$e');
    return BaseResponse(
        data: false, statusCode: e.statusCode, message: e.message);
  }
  // 如果请求状态成功则判断状态码
  // assert(response.data['msg'] == successStatus, '收藏视频接口返回的数据状态码不正确');
  response.data = true;
  return response;
}
